package com.yu.test.com;


import com.yu.annotion.Around;
import com.yu.annotion.Aspect;
import com.yu.annotion.Autowired;
import com.yu.annotion.Component;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

// aop设置
@Aspect
@Component
public class LogAspect {
    @Autowired
    private RedisService redisService;

    @Around(targetClass = UserServiceImpl.class, methods = "login")
    public Object log(Object realObject, Method method, Object... args) throws Exception {
        System.out.println("[aop前置通知] ...");
        Object o = method.invoke(realObject, args);
        System.out.println("[aop后置通知] ...");
        return o;
    }
}
